<?php

import('com.yado.drivers.IConnection');
import("com.mysql.yado.PrepearedStatement");
import("com.mysql.yado.TableDescriptor");
class Connection implements IConnection {
	
	private $_connection;
	private $_isConnected=false;
	public function connect($host,$userName,$password,$database) {
		$this->_connection = @mysql_connect($host,$userName,$password);
		mysql_select_db($database);
		$this->_isConnected=true;
	}
	
	public function disconnect() {
		if($this->_isConnected){
			mysql_close($this->_connection);
			$this->_isConnected=false;
		}
	}
	
	public function isConnected(){
		return $this->_isConnected;
	}
	
	public function prepearStatement($sql) {
		return new PrepearedStatement($this->_connection,$sql);
	}
	
	public function createTableDescriptor($name){
		return new TableDescriptor($name,$this);
	}
	
	public function getTable($name){
		
	}
}


?>